﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WCS_Entity.AutoQeuipment;
using WCS_Entity.Entity;
using WCS_Entity.Entity.Common;
using WCS_Entity.Entity.UpperSys;
using WCS_Entity.Prorocol;
using WCS_Entity.Rcs;
using WCS_Entity.User;
using WCS_Repository;
using WCS_Repository.Interface;
using WCS_Repository.Repositories;

namespace WCS_Service
{
    /// <summary>
    /// dbcodeFirst创建数据库的表
    /// </summary>
    public class DdCodeFirstService : IDbCodeFirstService
    {
        private readonly SqlSugarScope _dbBase;

        public DdCodeFirstService(IUnitOfWorkRepository unitOfWork)
        {
            _dbBase = unitOfWork.GetDbClient();
        }

        public void DbCodeFirstProcess()
        {
            _dbBase.CodeFirst.BackupTable().InitTables(typeof(UsersEntity),
                                                            typeof(UserLoginEntity),
                                                            typeof(RulesEntity),
                                                            typeof(MenusEntity),
                                                            typeof(RcsApiEntity),
                                                            typeof(RcsApiParameterEntity),
                                                            typeof(RcsServiceEntity),
                                                            typeof(ProtocolEntity),
                                                            typeof(AutoEquipmentsEntity),
                                                            typeof(MsgAbnormalEntity),
                                                            typeof(TaskEntity),
                                                            typeof(UpperSysServiceApiEntity),
                                                            typeof(MapPositionEntity),
                                                            typeof(UpperSysServiceEntity));
        }
    }
}
